package LeetcodeTest_eleven;
//重新排列数组
public class shuffle
{
    public static void main(String[] args)
    {
        int num[]={1,2,3,4,5,6,7,8,9,0};
        int result[]=new int[10];
        result=Solution.shuffle(num,5);
        for(int i=0;i<2*5;i++)
            System.out.print(result[i]+"  ");
    }
}
class Solution
{
    public static int[] shuffle(int[] nums, int n)
    {
        int answer[]=new int[2*n];
        int i,j;
        i=0;
        j=n;
        for(i=0;i<2*n;i++)
        {
            if(i%2==0)
                answer[i]=nums[i/2];
            else
            {
                answer[i]=nums[j];
                j++;
            }
        }
        return answer;
    }
}